#include "lvgl/lvgl.h"

/*******************************************************************************
 * Size: 20 px
 * Bpp: 4
 * Opts: 
 ******************************************************************************/

#ifndef FONTAWESOME
#define FONTAWESOME 1
#endif

#if FONTAWESOME

/*-----------------
 *    BITMAPS
 *----------------*/

/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = {
    /* U+F053 "" */
    0x0, 0xff, 0xe6, 0x8a, 0x45, 0xda, 0x54, 0x80,
    0x3f, 0xfa, 0x2, 0x93, 0x96, 0xe8, 0x86, 0xac,
    0xa5, 0x20, 0xf, 0xfe, 0x50, 0xa4, 0xe5, 0xb1,
    0x0, 0x78, 0x56, 0xb9, 0xc8, 0x3, 0xff, 0x8a,
    0x29, 0x39, 0x6c, 0x40, 0x1f, 0xe1, 0x4b, 0x52,
    0x0, 0xff, 0xe1, 0xa, 0x4e, 0x5b, 0x10, 0x7,
    0xf8, 0x52, 0x32, 0xdc, 0x80, 0x3f, 0xf8, 0x2,
    0x93, 0x96, 0xc4, 0x1, 0xfe, 0x14, 0x8c, 0xb7,
    0x20, 0xf, 0xfe, 0x0, 0xa4, 0xe5, 0xb1, 0x0,
    0x7f, 0x85, 0x23, 0x2d, 0xc8, 0x3, 0xff, 0x80,
    0x29, 0x39, 0x6c, 0x40, 0x1f, 0xe1, 0x48, 0xcb,
    0x72, 0x0, 0xff, 0xe0, 0x9c, 0x65, 0xb1, 0x0,
    0x7f, 0x85, 0x23, 0x2d, 0xc8, 0x3, 0xff, 0x86,
    0x2a, 0x84, 0x1, 0xff, 0xc1, 0x23, 0x42, 0x0,
    0xff, 0xe3, 0xb, 0x6e, 0x39, 0x80, 0x7f, 0xc6,
    0xf9, 0x88, 0x30, 0xf, 0xfe, 0x30, 0x9c, 0x6e,
    0x39, 0x80, 0x7f, 0xc6, 0xf9, 0x88, 0x30, 0xf,
    0xfe, 0x30, 0x9c, 0x6e, 0x39, 0x80, 0x7f, 0xc6,
    0xf9, 0x88, 0x30, 0xf, 0xfe, 0x30, 0x9c, 0x6e,
    0x39, 0x80, 0x7f, 0xc6, 0xf9, 0x88, 0x30, 0xf,
    0xfe, 0x30, 0x9c, 0x6e, 0x39, 0x80, 0x7f, 0xc6,
    0xf9, 0x88, 0x30, 0xf, 0xfe, 0x30, 0x9c, 0x6e,
    0x39, 0x80, 0x7f, 0xc6, 0xfc, 0xe4, 0x1, 0xff,
    0xc7, 0x13, 0x8d, 0xc7, 0x30, 0xf, 0xc4, 0xb0,
    0xc4, 0x1, 0xff, 0xca, 0x13, 0x8d, 0xc7, 0x30,
    0x1, 0x2d, 0x65, 0x28, 0x80, 0x7f, 0xf3, 0x84,
    0xe3, 0x3f, 0xdb, 0x4a, 0x20, 0x1c,

    /* U+F096 "" */
    0x0, 0xf8, 0x49, 0x15, 0x9d, 0xd1, 0x1f, 0xfc,
    0xd7, 0x73, 0x29, 0x88, 0x7, 0xf8, 0x9a, 0xff,
    0x6e, 0xa6, 0x20, 0xef, 0xff, 0xcd, 0x88, 0x4d,
    0x67, 0x6c, 0x20, 0x7, 0xb, 0x4c, 0x90, 0xd6,
    0xb7, 0xff, 0xff, 0xa5, 0xd9, 0x6, 0x4f, 0x52,
    0x60, 0x12, 0xe2, 0x1, 0xd4, 0x29, 0x0, 0x7f,
    0xf4, 0x84, 0xde, 0x14, 0x5, 0x50, 0x80, 0x2,
    0x1, 0x84, 0xc0, 0x3f, 0xfb, 0x6, 0x20, 0x3e,
    0x20, 0x1f, 0xff, 0xf0, 0xf, 0xff, 0xf8, 0x7,
    0xff, 0xfc, 0x3, 0xff, 0xfe, 0x1, 0xff, 0xff,
    0x0, 0xff, 0xea, 0x8, 0x1, 0x88, 0x40, 0xbd,
    0x40, 0x3f, 0xfa, 0xc2, 0x6a, 0x20, 0xdc, 0x40,
    0x3, 0xa9, 0x31, 0x6a, 0xc9, 0x87, 0x66, 0xff,
    0xe7, 0xbc, 0x5e, 0x41, 0x8a, 0xfb, 0x80, 0x62,
    0x7d, 0xc8, 0x40, 0x76, 0x89, 0x9f, 0xfe, 0x7c,
    0x33, 0x6a, 0xca, 0x41, 0x0,

    /* U+F104 "" */
    0x0, 0xff, 0xe1, 0xa, 0x4e, 0x6d, 0x28, 0x80,
    0x7f, 0xf0, 0x45, 0x27, 0x2d, 0x8c, 0xc, 0x40,
    0x3f, 0xe1, 0x49, 0xcb, 0x62, 0x23, 0x5e, 0x4a,
    0x8, 0x7, 0xc2, 0x93, 0x96, 0xc4, 0x46, 0xbc,
    0x94, 0x10, 0xf, 0x85, 0x27, 0x2d, 0x88, 0x8f,
    0x79, 0x28, 0x20, 0x1f, 0x85, 0x6e, 0xcc, 0x40,
    0x73, 0x90, 0x82, 0x1, 0xff, 0xa, 0xc4, 0xa0,
    0x81, 0xc5, 0x39, 0x0, 0x7f, 0xf0, 0x89, 0xaf,
    0x25, 0x1, 0x23, 0x2d, 0xc8, 0x3, 0xff, 0x84,
    0x4d, 0x79, 0x28, 0x9, 0x19, 0x6e, 0x40, 0x1f,
    0xfc, 0x22, 0x6b, 0xc9, 0x40, 0x48, 0xcb, 0x72,
    0x0, 0xff, 0xe1, 0x13, 0x5e, 0x4a, 0x2, 0x5a,
    0x90, 0x7, 0xff, 0x10, 0x9a, 0xfb, 0xf1, 0xc8,
    0x0,

    /* U+F1DB "" */
    0x0, 0xff, 0xe4, 0x11, 0xab, 0x3b, 0xa2, 0x3c,
    0xec, 0xa8, 0x42, 0x1, 0xff, 0xd5, 0x25, 0x8b,
    0xdf, 0xdc, 0xa9, 0x88, 0x33, 0x73, 0xc4, 0xd5,
    0xef, 0x73, 0x25, 0x8c, 0x40, 0x3f, 0xf9, 0x64,
    0xb3, 0xba, 0xa7, 0x51, 0x68, 0xbc, 0xef, 0xf7,
    0x77, 0x7f, 0xbb, 0x6e, 0x5d, 0x5, 0xa7, 0x3e,
    0xdc, 0xc4, 0x3, 0xff, 0x88, 0x29, 0x59, 0x4c,
    0xb, 0x3b, 0xd9, 0x2e, 0x86, 0x20, 0x1f, 0xc2,
    0x48, 0xd1, 0x5b, 0xd6, 0xc4, 0x91, 0x94, 0xc4,
    0x1, 0xff, 0xc0, 0x16, 0xaa, 0x28, 0x24, 0xfd,
    0x31, 0x0, 0x7f, 0xf2, 0xc5, 0x27, 0x6d, 0x89,
    0x27, 0xe0, 0xc0, 0x3f, 0x92, 0x20, 0x82, 0x97,
    0x4c, 0x40, 0x1f, 0xfd, 0x11, 0x49, 0xe7, 0x12,
    0x78, 0x61, 0x0, 0xf2, 0xf3, 0x8, 0x9e, 0x14,
    0x40, 0x3f, 0xfa, 0xc7, 0x30, 0x60, 0x94, 0xc2,
    0x1, 0x8f, 0x5c, 0x5, 0xf0, 0xc0, 0x3f, 0xfb,
    0x22, 0x96, 0x60, 0x7a, 0x80, 0x19, 0xc8, 0x80,
    0x5c, 0xc0, 0x1f, 0xfd, 0xb2, 0x23, 0x0, 0x18,
    0x84, 0x3, 0xff, 0xd6, 0x20, 0x19, 0x88, 0x80,
    0x7a, 0xc0, 0x1f, 0xfd, 0xb2, 0x23, 0x80, 0x18,
    0x84, 0x2, 0x2c, 0x41, 0x4, 0xd4, 0x0, 0xff,
    0xec, 0x92, 0xd1, 0x2, 0x62, 0x80, 0x72, 0x53,
    0x10, 0xb4, 0x39, 0x0, 0x7f, 0xf5, 0x96, 0x24,
    0x81, 0x79, 0x84, 0x3, 0xc7, 0x32, 0x62, 0x38,
    0xe7, 0x30, 0xf, 0xfe, 0x88, 0xad, 0xd9, 0x41,
    0x26, 0x14, 0x3, 0xf8, 0x52, 0x79, 0xcc, 0xd1,
    0x98, 0x84, 0x20, 0xf, 0xfe, 0x48, 0x9b, 0xdf,
    0xd2, 0x2, 0xd5, 0x18, 0x80, 0x3f, 0xf8, 0x27,
    0x19, 0x88, 0x51, 0x7b, 0xde, 0xb9, 0x75, 0x42,
    0x11, 0x0, 0x42, 0x22, 0x35, 0x68, 0xad, 0xec,
    0x85, 0x27, 0xbf, 0xa4, 0x10, 0xf, 0xfe, 0x31,
    0xbd, 0x66, 0x29, 0xd5, 0x9e, 0x2a, 0xf7, 0xb9,
    0xff, 0x77, 0x37, 0x2a, 0x5d, 0x5, 0xa2, 0xff,
    0x21, 0x4, 0x3, 0xff, 0x98, 0x26, 0xb1, 0x7b,
    0xdc, 0xdc, 0xba, 0xa4, 0xcd, 0x54, 0xbc, 0xde,
    0xfe, 0xc9, 0x74, 0x10, 0xf, 0xfe, 0x10
};


/*---------------------
 *  GLYPH DESCRIPTION
 *--------------------*/

static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
    {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
    {.bitmap_index = 0, .adv_w = 229, .box_w = 39, .box_h = 19, .ofs_x = 1, .ofs_y = -2},
    {.bitmap_index = 214, .adv_w = 251, .box_w = 51, .box_h = 16, .ofs_x = -1, .ofs_y = 0},
    {.bitmap_index = 339, .adv_w = 114, .box_w = 24, .box_h = 12, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 444, .adv_w = 274, .box_w = 57, .box_h = 18, .ofs_x = -1, .ofs_y = -2}
};

/*---------------------
 *  CHARACTER MAPPING
 *--------------------*/

static const uint16_t unicode_list_0[] = {
    0x0, 0x43, 0xb1, 0x188
};

/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
    {
        .range_start = 61523, .range_length = 393, .glyph_id_start = 1,
        .unicode_list = unicode_list_0, .glyph_id_ofs_list = NULL, .list_length = 4, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
    }
};



/*--------------------
 *  ALL CUSTOM DATA
 *--------------------*/

/*Store all the custom data of the font*/
static lv_font_fmt_txt_dsc_t font_dsc = {
    .glyph_bitmap = gylph_bitmap,
    .glyph_dsc = glyph_dsc,
    .cmaps = cmaps,
    .kern_dsc = NULL,
    .kern_scale = 0,
    .cmap_num = 1,
    .bpp = 4,
    .kern_classes = 0,
    .bitmap_format = 1
};


/*-----------------
 *  PUBLIC FONT
 *----------------*/

/*Initialize a public general font descriptor*/
lv_font_t FontAwesome = {
    .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt,    /*Function pointer to get glyph's data*/
    .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt,    /*Function pointer to get glyph's bitmap*/
    .line_height = 19,          /*The maximum line height required by the font*/
    .base_line = 2,             /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
    .subpx = LV_FONT_SUBPX_HOR,
#endif
    .dsc = &font_dsc           /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
};

#endif /*#if FONTAWESOME*/

